export const TokenName = 'token'

export default function () {
  /**
   * 设置token
   */
  function setToken(token: string) {
    localStorage.setItem(TokenName, token)
  }

  /**
   * 获取token
   */
  function getToken() {
    return localStorage.getItem(TokenName)
  }

  /**
   * 移除token
   */
  function removeToken() {
    localStorage.removeItem(TokenName)
  }

  return {
    setToken,
    getToken,
    removeToken
  }
}
